import reshandler from 'services/response-handler'
/*
 * 自动登陆接口
 */
function makeData(response) {
  return Object.assign({}, response, {
    "userId": response.userId || "",
    "userUuid": response.userUuid || "",
    "userImid": response.userImid || "",
    "userName": response.userName || "",
    "nickName": response.nickName || "",
    "realName": response.realName || "",
    "hasPassword": response.hasPassword || "",
    "gender": response.gender || "",
    "mobile": response.mobile || "",
    "headerUrl": response.headerUrl || "",
    "carId": response.carId || "",
    "carPlateNumber": response.carPlateNumber || "",
    "point": response.point || "",
    "imLoginState": response.imLoginState || "",
    "messageTypeMap": response.messageTypeMap || {},
    "messageCategoryMap": response.messageCategoryMap || {},
    "cars": response.cars || [],
    "platformSignDays": response.platformSignDays || "1",
    "shopContinueSignDays": response.shopContinueSignDays || "0",
    "soundSetting": response.soundSetting || "1",
    "shop": response.shop || {},
    "role": response.role || "0",
    "signInState": response.signInState || "0",
    "ad": response.ad || {},
  })
}
export default function (params, success, fail) {
  // request 
  params = Object.assign({}, params, {
    methodName: "Index",
  })

  // invoke
  this.$.get(params)
    .then(reshandler.success(success, fail, makeData), reshandler.error(fail))
}
